﻿namespace Snipps.Views
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;

    /// <summary>
    ///     Interaction logic for EditTagView.xaml
    /// </summary>
    public partial class EditTagView : UserControl
    {
        public EditTagView()
        {
            InitializeComponent();
            btnSave.IsEnabledChanged += BtnSaveOnIsEnabledChanged;
        }

        private void BtnSaveOnIsEnabledChanged(
            object sender, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            if (!btnSave.IsEnabled && btnSave.IsFocused)
            {
                var tRequest = new TraversalRequest(FocusNavigationDirection.Next);
                btnSave.MoveFocus(tRequest);
            }
        }
    }
}